﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "用户管理";
}
@using WFramework.MvcPager
@model PagedList<MiniWeb.Core.Entities.AdminUser>
<link href="../../Scripts/colorbox/colorbox.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
<script src="../../Scripts/AdminCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function() {
        $(".box").colorbox({
            iframe: true,
            width: 550,
            height: 550,
            onClosed: function() {
                window.location.reload();
            }
        });
    });

    function IsLock(str, data) {
        if (str == '解锁')
            url = '/AdminUsers/UnLock';
        else url = '/AdminUsers/Lock';
        if (confirm('是否确定' + str + '?')) {
            $.post(url, data, function () {
                alert(str + "成功");
                window.location.reload();
            });
        }
    }
</script>
<div class="right_box_card">
    <ul>
        <li class="right_box_card1"><a href="#">用户管理</a></li>
    </ul>
</div>
<div style="line-height: 40px;">
    <p class="avatar_btn">
        <a href="@Url.Action("Save", "AdminUsers")" class="box" id="lnkAdd">新增用户</a>
    </p>
</div>
<div>
    @using (Html.BeginForm("List", "AdminUsers", FormMethod.Get))
    {
        <table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    用户名称：@Html.TextBox("account", null, new { @class = "text-input" })
                </td>
               
                <td>
                    <input type="submit" value="查找" class="submit" style="float: left; width: 80px;" />
                </td>
            </tr>
            
        </table>
    }
</div>
<table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr height="30" class="tab_title">
        <td>
            ID
        </td>
        <td>
            用户名称
        </td>
      
       
        <td>
            是否锁定
        </td>
        <td>
            用户类型
        </td>
        <td>
            操作
        </td>
    </tr>
    @foreach (var item in Model)
    {
        <tr height="35" class="tab_td1">
            <td>
                @item.AdminUserId
            </td>
            <td>
                @item.UserName
            </td>
           
            <td>
                @(item.IsLock ? "是":"否")
            </td>
            <td>
                @(item.RoleId==1 ? "超级管理员":"渠道用户")
            </td>

            <td>
                @Html.ActionLink("修改", "Save", "AdminUsers", new { id = item.AdminUserId }, new { @class = "box" })
                <a href="#" onclick="DeletePost('/AdminUsers/Delete', { id: @item.AdminUserId})">
                    删除</a>
                <a href="#" onclick="IsLock(@(item.IsLock ? "'解锁'":"'锁定'"), { id: @item.AdminUserId})">@(item.IsLock ? "解锁":"锁定")</a>
            </td>
        </tr>
    }
</table>
<div style="padding:10px;">
    @Html.Pager(Model)
</div>